package cn.fl.audit.transform;

import java.util.ArrayList;
import java.util.List;

import cn.cmm.base.framework.utils.CollectionUtils;
import cn.fl.audit.dto.AudCreditExtInfoDTO;
import cn.fl.audit.vo.AudCreditExtInfoVO;

 /**
 * @Description: 信审扩展资料 转换器
 * @Description: VO是客户端传递数据到服务端进行转换的数据 
 * @Description: VO转换数据变成DTO传递到服务端 
 * @Description: VO不能在服务端出现
 */
public class AudCreditExtInfoVOTransform {


	/**
	 * DTO 转  VO
	 * @param po AudCreditExtInfoDTO
	 * @return AudCreditExtInfoVO
	 */
	public static AudCreditExtInfoVO toVO(AudCreditExtInfoDTO dto) {
		AudCreditExtInfoVO  vo = null;
		if (dto != null) { 
			vo = new AudCreditExtInfoVO();
			vo.setId(dto.getId());
			vo.setOpinionId(dto.getOpinionId());//通过意见外键
			vo.setCreditInfo(dto.getCreditInfo());//信审资料
			vo.setQualificationsInfo(dto.getQualificationsInfo());//资质情况
			vo.setAssetsProveCd(dto.getAssetsProveCd());//资产证明
			vo.setResearchReport(dto.getResearchReport());//调查报告
			vo.setTimes(dto.getTimes());//融资次数
			vo.setBadRecordInfo(dto.getBadRecordInfo());//不良情况
			vo.setCourtsEnforceInfo(dto.getCourtsEnforceInfo());//法院执行情况
			vo.setRegisterTm(dto.getRegisterTm());//注册时间
			vo.setBusiness(dto.getBusiness());//主营业务
			vo.setJob(dto.getJob());//从事工作
			vo.setRelationshipCd(dto.getRelationshipCd());//与承租人关系-数据字典
			vo.setTypeCd(dto.getTypeCd());//资料类型-数据字典 0-承租人 1-担保人
			
			vo.setAssetsProveCdNm(dto.getAssetsProveCdNm());
			vo.setRelationshipCdNm(dto.getRelationshipCdNm());

			vo.setCrtTm(dto.getCrtTm());//创建时间
			vo.setCrtUsrId(dto.getCrtUsrId());//创建人
			vo.setMdfTm(dto.getMdfTm());//修改时间
			vo.setMdfUsrId(dto.getMdfUsrId());//修改人
		}
		return vo;
	}

	/**
	 * VO 转 DTO
	 * @param dto AudCreditExtInfoVO
	 * @return AudCreditExtInfoDTO
	 */
	public static AudCreditExtInfoDTO toDTO(AudCreditExtInfoVO vo) {
		AudCreditExtInfoDTO dto = null;
		if (vo != null) {
			dto = new AudCreditExtInfoDTO();
			dto.setId(vo.getId());
			dto.setOpinionId(vo.getOpinionId());//通过意见外键
			dto.setCreditInfo(vo.getCreditInfo());//信审资料
			dto.setQualificationsInfo(vo.getQualificationsInfo());//资质情况
			dto.setAssetsProveCd(vo.getAssetsProveCd());//资产证明
			dto.setResearchReport(vo.getResearchReport());//调查报告
			dto.setTimes(vo.getTimes());//融资次数
			dto.setBadRecordInfo(vo.getBadRecordInfo());//不良情况
			dto.setCourtsEnforceInfo(vo.getCourtsEnforceInfo());//法院执行情况
			dto.setRegisterTm(vo.getRegisterTm());//注册时间
			dto.setBusiness(vo.getBusiness());//主营业务
			dto.setJob(vo.getJob());//从事工作
			dto.setRelationshipCd(vo.getRelationshipCd());//与承租人关系-数据字典
			dto.setTypeCd(vo.getTypeCd());//资料类型-数据字典 0-承租人 1-担保人

			dto.setCrtTm(vo.getCrtTm());//创建时间
			dto.setCrtUsrId(vo.getCrtUsrId());//创建人
			dto.setMdfTm(vo.getMdfTm());//修改时间
			dto.setMdfUsrId(vo.getMdfUsrId());//修改人
		}
		return dto;
	}
	
	/**
	 * DTO集合 转 VO集合
	 * @param List<AudCreditExtInfoDTO>
	 * @return List<AudCreditExtInfoVO>
	 */
	public static List<AudCreditExtInfoVO> toVOList(List<AudCreditExtInfoDTO> list) {
		List<AudCreditExtInfoVO>  voList = new ArrayList<AudCreditExtInfoVO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (AudCreditExtInfoDTO dto : list) {
				voList.add(toVO(dto));
			}
		}
		return voList;
	}
	
	/**
	 * VO集合 转 DTO集合
	 * @param list List<AudCreditExtInfoVO>
	 * @return List<AudCreditExtInfoDTO>
	 */
	public static List<AudCreditExtInfoDTO> toDTOList(List<AudCreditExtInfoVO> list) {
		List<AudCreditExtInfoDTO>  dtoList = new ArrayList<AudCreditExtInfoDTO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (AudCreditExtInfoVO vo : list) {
				dtoList.add(toDTO(vo));
			}
		}
		return dtoList;
	}
}
